home *** CD-ROM | disk | FTP | other *** search
- /*
- File: FWXmain.h
-
- Contains: Definitions for FireWire File Exchange application.
-
- Version: 1.0
-
- Written by: Jay Lloyd
-
- Copyright: © 1996-1998 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: Jay Lloyd
-
- Other Contact:
-
- Technology: FireWire
-
- Writers:
-
- (jkl) Jay Lloyd
-
- Change History (most recent first):
-
- <24> 1/15/98 jkl Update for new headers.
- <FW23> 6/19/97 jkl Added another preference flag for icon view. Made preferences a
- long instead of a byte. Added AppleScript defines and an
- AppleEvent send queue definition.
- <FW22> 6/10/97 jkl Moved QDGlobals to main.c global for easier code warrior
- compiles.
- <FW21> 5/27/97 jkl Added room for 4 byte packet index to control packet buffers.
- <FW20> 5/15/97 jkl Added routine declarations.
- <FW19> 5/7/97 jkl Updated list data structures with a previous pointer to make
- them double linked lists.
- <FW18> 4/29/97 jkl Added declarations for some new routines and added a busyAlert
- resource ID.
- <FW17> 4/8/97 jkl Added key definitions for page up, page down, home and end for
- keyboard scrolling. Changed my initials.
- <FW16> 3/18/97 jkl Moved prefs related definitions to prefs.h.
- <FW15> 2/27/97 jkl Modified constants for file conflict preferences to be under
- receiver control. Added constants for scrolling support in
- sender window.
- <FW14> 2/21/97 jkl Got rid of unused constants and added memory error alert.
- <FW13> 2/19/97 jkl Adjusted counts and sizes of buffers.
- <FW12> 2/13/97 jkl Modified count and size of buffers.
- <FW11> 2/13/97 jkl Modified count and size of buffers.
- <FW10> 2/11/97 jkl Added queue definitions, modified buffer numbers and sizes.
- <FW9> 2/2/97 jkl Modified resource definitions to match HI spec.
- <FW8> 1/27/97 ES Added defs for FW Control PB queue.
- <FW7> 1/27/97 jkl Added error alert resource id's and error constants. Updated
- menu constants. Added a sendflags field to the send queue.
- Defined a pre-send check queue record and my timer task record
- with node id on the end.
- <FW6> 1/16/97 jkl Changed notify sound resource preference to not conflict with
- another string resource.
- <FW5> 1/16/97 jkl Added new user interface features. Constants for notification
- and preferences dialog.
- <FW4> 11/13/96 jkl Added data structure to handle receives from multiple machines.
- <FW3> 10/16/96 jkl Modified queue structure for send queue to handle
- multiple files and folders.
- <FW2> 10/16/96 jkl renamed constants for clarity, changed number
- and sizes of buffers for performance experiments
- <FW1> 10/2/96 jkl initial check-in
- */
-
- #ifndef __FWXMAIN__
- #define __FWXMAIN__
-
- #include <Drag.h>
- #include <Timer.h>
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- #define kDITop 0x0050
- #define kDILeft 0x0070
-
- #define kFileReadBufs 2 // number of buffers to allocate for file reads
- #define kFileReadBufSize (32*1024) // buffer size for file reads
-
- #define kFWControlParams 20 // number of param blocks to allocate for control packets
- #define kFWControlParamBufferSize (sizeof (CInfoPBRec) + 8) // size of control packet buffer, big enough for CatInfo
-
- #define kFWReadControlBufs 20 // number of read control buffers to pass to driver
- #define kFWReadControlBufSize (sizeof (CInfoPBRec) + 8) // size of read control buffers
-
- #define kFWReadDataBufs 6 // number of read data buffers to pass to driver
- #define kFWReadDataBufSize (32*1024) // size of read data buffers
-
- #define kCanSelectDesktop true
-
- // error constants
- enum
- {
- kItemExistsError = 1,
- kSpaceError = 2,
- kUnknownError = -1
- };
-
- enum
- {
- // Apple event class for FireWire File Exchange driver family.
- kAEFWXSendEventID = 'send',
- kAEFWXNodeListID = 'node',
- kAEFWXNodeKeyword = 'node'
- };
-
- // prefs constants
- enum
- {
- kNoNotificationPosted = 0,
- kNotificationPosted = 1,
-
- // the preferences are stored as a long with these bit fields
- kConflictCancel = 0x01,
- kConflictRename = 0x02,
- kConflictOverwrite = 0x04,
- kNotifyFlash = 0x10,
- kNotifyAlert = 0x20,
- kNotifySound = 0x40,
- kNotifyOpen = 0x80,
- kIconView = 0x100 // if bit is clear: large icon, set: small icon
- };
-
- // resource and menu constants
- enum
- {
- kMenuBarResourceID = 128,
- kWindowResourceID = 128,
-
- kAboutAlertResourceID = 128,
- kNoNameAlertID = 130,
- kUnknownErrAlertID = 133,
- kSpaceErrAlertID = 134,
- kCantQuitAlertID = 136,
- kCommunicationErrorAlertID = 137,
- kNodeDisconnectAlertID = 138,
- kMemoryErrorAlertID = 139,
- kIOErrorAlertID = 140,
- kRecvErrorAlertID = 141,
- kItemExistsErrAlertID = 142,
- kItemBusyErrAlertID = 143,
- kNSVErrAlertID = 144,
- kReceiveAlertID = 145,
- kReceiverQuitAlertID = 146,
-
- kAppleMenuID = 128,
- kAboutMenuItem = 1,
-
- kFileMenuID = 129,
- kOpenMenuItem = 1,
- kCloseMenuItem = 2,
- kOpenDropMenuItem = 4,
- kQuitMenuItem = 6,
-
- kEditMenuID = 130,
- kPrefsMenuItem = 8,
-
- kViewMenuID = 131,
- kSmallIconMenuItem = 1,
- kIconMenuItem = 2,
-
- kPrefsDlogID = 131,
- kOKButton = 1,
- kCancelButton = 2,
- kFlashBox = 3,
- kAlertBox = 4,
- kSoundBox = 5,
- kOpenBox = 6,
- kSoundPopup = 7,
- kDropName = 9,
- kDropButton = 10,
- kCancelRadio = 12,
- kRenameRadio = 13,
- kOverwriteRadio = 14,
- kDefaultUserItem = 16,
-
- kReturnKey = 13,
- kEnterKey = 3,
- kEscapeKey = 27,
- kPeriodKey = 46,
- kPageUpKey = 11,
- kPageDownKey = 12,
- kHomeKey = 1,
- kEndKey = 4,
-
- kProgressPrompt = 2,
- kProgressBarUserItem = 4,
- kCopyProgressDlog = 129,
-
- kVScrollBar = 128,
- kHScrollBar = 129,
-
- kDropIconSuiteID = 128,
- kAppIconSuiteID = 129,
- kNotifyIcon = 128,
- kNotifyString = 128,
- kNetworkNameID = -16413
- };
-
- // scroll bar offset constants
- enum
- {
- kScrollBarWidth = 16,
- kScrollBarAdjust = kScrollBarWidth - 1,
- kScrollBarTweek = 2
- };
-
- // global data for Drag Manager handlers
- struct DragHandlerGlobals {
- Boolean acceptableDragFlag;
- short hilitedSpace;
- };
- typedef struct DragHandlerGlobals DragHandlerGlobals, *DragHandlerGlobalsPtr;
-
-
- // global data for application
- struct FWXAppStruct
- {
- DragHandlerGlobals dragHandlerGlobals;
-
- AEEventHandlerUPP openApplicationEventHandler;
- AEEventHandlerUPP openDocumentsEventHandler;
- AEEventHandlerUPP quitApplicationEventHandler;
- AEEventHandlerUPP fileSpecListHandler;
- AEEventHandlerUPP sendItemsEventHandler;
- AEEventHandlerUPP getNodeListEventHandler;
- DragTrackingHandlerUPP dragTrackingHandler;
- DragReceiveHandlerUPP dragReceiveHandler;
- DragReceiveHandlerUPP deviceAddedEventHandler;
- DragReceiveHandlerUPP deviceRemovedEventHandler;
- IOCompletionUPP fileWriteCompletionHandler;
- IOCompletionUPP fileReadCompletionHandler;
-
- FWXClientID fwxClientID;
-
- WindowPtr pSenderWindow;
-
- NMRecPtr pNotifyRec;
-
- FSSpec fwixReceiveFolder;
- Str31 fwixNotifySound;
- UInt32 fwixPrefs;
-
- Boolean getNodeListEventHandlerInstalled;
- Boolean sendItemsEventHandlerInstalled;
- Boolean deviceRemovedEventHandlerInstalled;
- Boolean deviceAddedEventHandlerInstalled;
- Boolean dragReceiveHandlerInstalled;
- Boolean dragTrackingHandlerInstalled;
- Boolean fileSpecListHandlerInstalled;
- Boolean quitApplicationEventHandlerInstalled;
- Boolean openDocumentsEventHandlerInstalled;
- Boolean openApplicationEventHandlerInstalled;
- Boolean quitFlag;
- Boolean inForeground;
- };
- typedef struct FWXAppStruct FWXAppData,
- *FWXAppDataPtr;
-
-
- typedef struct FWXPacketStruct FWXPacket, *FWXPacketPtr;
- struct FWXPacketStruct
- {
- UInt32 packetIndex;
- UInt32 packetType;
- Ptr packetData;
- };
-
-
- typedef struct TxFsSpecQueueStruct TxFSSpec, *TxFSSpecPtr;
- struct TxFsSpecQueueStruct
- {
- QElemPtr qLink;
- FSSpecPtr pFSSpec;
- FWXNodeID recvNode;
- UInt32 itemType;
- };
-
- typedef struct AESendQueueStruct AESendRec, *AESendRecPtr;
- struct AESendQueueStruct
- {
- QElemPtr qLink;
- FSSpecPtr pSendItemsList;
- FWXNodeID recvNode;
- UInt16 numSendItems;
- };
-
- typedef struct NodeSendStruct NodeSendItem, *NodeSendItemPtr;
- struct NodeSendStruct
- {
- NodeSendItemPtr pNextSendItem,
- pPreviousSendItem;
- FSSpec sendItemSpec;
- UInt32 itemSize;
- };
-
- typedef struct MyTMTask MyTMTask, *MyTMTaskPtr;
- struct MyTMTask
- {
- TMTask timerTask; // regular time struct
- FWXNodeID nodeID; // add node id since we will normally
- // be using this for errors with nodes
- };
-
- typedef struct CurFileQueueStruct CurFileInfo, *CurFileInfoPtr;
- struct CurFileQueueStruct
- {
- QElemPtr qLink;
- FSSpecPtr pCurFileSpec;
- FWXNodeID curFileSenderID;
- UInt32 forkLength;
- UInt32 recvLength;
- SInt32 curDirID;
- SInt16 curFileRefNum;
- OSErr curError;
- };
-
- OSErr HandlePrefsDialog (void);
- OSErr InitPrefs (void);
- void HandleIdle (void);
- OSErr GetCurFileInfo(
- FWXNodeID recvNodeID,
- CurFileInfoPtr *hCurFileInfo,
- Boolean createNew);
- OSErr InitRecvFolder(
- SInt32 *dirID);
- void UpdateNotification (
- NMRecPtr pNMRec);
- OSErr SaveWindowPos (
- WindowPtr pWin);
- OSErr GetWindowPos (
- Rect *r);
- void HandleUpdateEvent (
- EventRecord *pEventRecord);
- SInt16 HandleCautionAlert (
- SInt16 alertResID);
- SInt16 HandleStopAlert (
- SInt16 alertResID);
- SInt16 HandleNoteAlert (
- SInt16 alertResID);
- SInt16 HandleAlert (
- SInt16 alertResID);
- pascal OSErr HandleFileWriteComplete (
- ParmBlkPtr pFilePB);
- void HandleFWWriteComplete (
- IOParamPtr pFilePB);
- void HandleFWControlComplete (
- IOParamPtr pFWPB);
- void HandleFWReadComplete (
- IOParamPtr pFilePB);
- pascal OSErr HandleFileReadComplete (
- ParmBlkPtr pFilePB);
- void SetupFileReadPB (
- IOParamPtr pb);
- void SetupFWWritePB(
- IOParamPtr pb);
- void SetupFWControlPB (
- IOParamPtr pb);
- OSErr FWIXDequeue (
- QElemPtr *ppQElem,
- QHdrPtr pQHdr);
- OSErr UpdatePrefsFile (void);
- OSErr SendFSSpecListToSelf (
- FWXNodeID fwxNodeID,
- FSSpecPtr pFSSpecList,
- UInt16 numItems);
-
-
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-